import Vue from "vue";
import Router from "vue-router";
import Layout from "./views/Layout.vue";
//Staff
import StaffList from "./views/user/staff/StaffList.vue";
import AddStaff from "./views/user/staff/AddStaff.vue";
import EditStaff from "./views/user/staff/EditStaff.vue";
import StaffBindDevice from "./views/user/staff/StaffBindDevice.vue";
//Company
import Company from "./views/company/CompanyWrap.vue";
import CompanyList from "./views/company/CompanyList.vue";
import AddCompany from "./views/company/AddCompany.vue";
import EditCompany from "./views/company/EditCompany.vue";
import CompanyPush from "./views/company/CompanyPush.vue";
import ToWeb from "./views/company/ToWeb.vue";
//Audit
import Audit from "./views/audit/AuditWrap.vue";
import LoginLog from "./views/audit/LoginLog.vue";
import OperateLog from "./views/audit/OperateLog.vue";
//Profile
import Profile from "./views/setting/Profile.vue";
//Login
import Login from "./views/Login";
//Device
import Device from "./views/device/DeviceWrap.vue";
import UnbindDevice from "./views/device/unbind/UnbindDevice.vue";
import AllocationDevice from "./views/device/unbind/AllocationDevice.vue";
import BindDevice from "./views/device/bind/BindDevice.vue";
import TrashCanLocation from "./views/device/trashcan/TrashCanLocation.vue";
import AddDevice from "./views/device/unbind/AddDevice.vue";
import AddBatchDevice from "./views/device/unbind/AddBatchDevice.vue";
import EditDevice from "./views/device/unbind/EditDevice.vue";
import DeviceDetail from "./views/device/bind/DeviceDetail.vue";
import InstructDevice from "./views/device/bind/InstructDevice.vue";
import ReportDevice from "./views/device/bind/ReportDevice.vue";
import AddTrashCanLocation from "./views/device/trashcan/AddTrashCanLocation.vue";
import EditTrashCanLocation from "./views/device/trashcan/EditTrashCanLocation.vue";
import BindTrashCanLocation from "./views/device/trashcan/BindTrashCanLocation.vue";
//user
import User from "./views/user/UserWrap.vue";
import UserList from "./views/user/UserList.vue";
import AddUser from "./views/user/AddUser.vue";
import EditUser from "./views/user/EditUser.vue";
import AuthUser from "./views/user/AuthUser.vue";
//Auth
import Auth from "./views/auth/AuthWrap.vue";
import AuthRule from "./views/auth/AuthRule.vue";
import AddAuthRule from "./views/auth/AddAuthRule.vue";
import EditAuthRule from "./views/auth/EditAuthRule.vue";
//Auth group
import AuthGroupWrap from "./views/authgroup/AuthGroupWrap.vue";
import AuthGroup from "./views/authgroup/AuthGroup.vue";
import AddAuthGroup from "./views/authgroup/AddAuthGroup.vue";
import EditAuthGroup from "./views/authgroup/EditAuthGroup.vue";
import GrantAuthRule from "./views/authgroup/GrantAuthRule.vue";
//Setting
import Setting from "./views/setting/SettingWrap.vue";
import SystemSetting from "./views/setting/SystemSetting.vue";
//app version
import AppVersion from "./views/appversion/AppVersionWrap";
import AppVersionList from "./views/appversion/AppVersionList";
import AddAppVersion from "./views/appversion/AddAppVersion";
import EditAppVersion from "./views/appversion/EditAppVersion";

Vue.use(Router);

export default new Router({
  routes: [
    {
      path: "/login",
      name: "login",
      component: Login
    },
    {
      path: "/",
      component: Layout,
      children: [
        { path: "", redirect: "/user" },
        // {
        //   path: "/home",
        //   component: Home
        // },
        {
          path: "/company",
          component: Company,
          children: [
            { path: "/company", redirect: "/company/list" },
            { path: "/company/list", component: CompanyList },
            { path: "/company/add", component: AddCompany },
            { path: "/company/edit/:id", component: EditCompany },
            { path: "/company/push/:id", component: CompanyPush },
            { path: "/company/toweb/:id", component: ToWeb }
          ]
        },
        {
          path: "/user",
          component: User,
          children: [
            { path: "/user", redirect: "/user/system" },
            { path: "/user/system", component: UserList },
            { path: "/user/system/add", component: AddUser },
            { path: "/user/system/edit/:id", component: EditUser },
            { path: "/user/system/auth/:id", component: AuthUser },
            { path: "/user/staff", component: StaffList },
            { path: "/user/staff/add", component: AddStaff },
            { path: "/user/staff/edit/:id", component: EditStaff },
            { path: "/user/staff/bind/:id", component: StaffBindDevice }
          ]
        },
        {
          path: "/app_version",
          component: AppVersion,
          children: [
            { path: "/app_version", component: AppVersionList },
            { path: "/app_version/add", component: AddAppVersion },
            { path: "/app_version/edit/:id", component: EditAppVersion }
          ]
        },
        {
          path: "/auth/rule",
          component: Auth,
          children: [
            { path: "/auth/rule", component: AuthRule },
            { path: "/auth/rule/add", component: AddAuthRule },
            { path: "/auth/rule/edit/:id", component: EditAuthRule }
          ]
        },
        {
          path: "/auth/group",
          component: AuthGroupWrap,
          children: [
            { path: "/auth/group", component: AuthGroup },
            { path: "/auth/group/add", component: AddAuthGroup },
            { path: "/auth/group/edit/:id", component: EditAuthGroup },
            { path: "/auth/group/grant/:id", component: GrantAuthRule }
          ]
        },
        {
          path: "/audit",
          component: Audit,
          children: [
            { path: "/audit", redirect: "/audit/loginlog" },
            { path: "/audit/loginlog", component: LoginLog },
            { path: "/audit/operatelog", component: OperateLog }
          ]
        },
        {
          path: "/device",
          component: Device,
          children: [
            { path: "/device", redirect: "/device/unbind" },
            { path: "/device/unbind", component: UnbindDevice },
            { path: "/device/unbind/add", component: AddDevice },
            { path: "/device/unbind/add/batch", component: AddBatchDevice },
            { path: "/device/unbind/edit/:id", component: EditDevice },
            {
              path: "/device/unbind/allocation/:id",
              component: AllocationDevice
            },
            { path: "/device/bind", component: BindDevice },
            { path: "/device/bind/detail/:id", component: DeviceDetail },
            { path: "/device/bind/instruct/:id", component: InstructDevice },
            { path: "/device/bind/report/:id", component: ReportDevice },
            { path: "/device/trashcan/location", component: TrashCanLocation },
            {
              path: "/device/trashcan/location/add",
              component: AddTrashCanLocation
            },
            {
              path: "/device/trashcan/location/edit/:id",
              component: EditTrashCanLocation
            },
            {
              path: "/device/trashcan/location/bind/:id",
              component: BindTrashCanLocation
            }
          ]
        },
        {
          path: "/setting",
          component: Setting,
          children: [
            { path: "/setting", redirect: "/setting/system" },
            { path: "/setting/system", component: SystemSetting },
            { path: "/setting/profile", component: Profile }
          ]
        },
        { path: "*", redirect: "/home" }
      ]
    }
  ]
});
